package com.fjt.book_pay.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.fjt.book_pay.dao.BankDao;
import com.fjt.book_pay.pojo.Bank;

@Service("bankservice")
public class BankService {
	private BankDao bankDao;
	private Bank bank;
	
	public BankDao getBankDao() {
		return bankDao;
	}
	@Resource
	public void setBankDao(BankDao bankDao) {
		this.bankDao = bankDao;
	}
	public Bank getBank() {
		return bank;
	}
	@Resource(name="bank")
	public void setBank(Bank bank) {
		this.bank = bank;
	}
	
	public Bank findBankAccountById(Bank bank){
		return bankDao.findBankAccountById(bank);
	}
	
	public boolean validateUser(Bank bank){
		if(bankDao.validateUser(bank)!=null){
			return true;
		}else return false;
	}
	
	public boolean addBankMoney( int bank_number,int money){
		return bankDao.addBankMoney(bank_number, money);
	}
	
	public boolean subBankMoney(int bank_number,String password,int money){
		return bankDao.subBankMoney(bank_number,password, money);
	}
			
	public int checkmoney(Bank bank){
		return bankDao.checkmoney(bank);
	}
}
